home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / FWDebug / Include / FWSymFil.h < prev    next >
Encoding:
Text File  |  1994-04-21  |  3.5 KB  |  121 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWSymFil.h
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Creation Date:        3/28/94
  7. //
  8. //    Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #if !defined(FWSYMFIL_H) && defined(FW_BUILD_WIN)
  13. #define FWSYMFIL_H
  14.  
  15. #ifdef FW_DEBUG
  16.  
  17. #ifndef FWSTDDEFS_H
  18. #include "FWStdDef.h"
  19. #endif
  20.  
  21. #if !defined(__INC_WINDOWS)
  22. #include <windows.h>
  23. #endif
  24.  
  25. //========================================================================================
  26. // FW_CPrivWinSymFile:
  27. //
  28. // Interface to Windows format .SYM files.  They are generated from link .MAP
  29. // files by Microsoft MAPSYM tool and contain a list of publics in a module sorted
  30. // by segment and Offset.  We use .SYM files to produce better FW_DEBUG printouts.
  31. //========================================================================================
  32.  
  33. class FW_CPrivWinSymFile
  34. {
  35. public:
  36.     FW_CPrivWinSymFile(const char* pzFileName);
  37.     /* Tries to load a .SYM file defined by pzFileName.  If the load fails, no
  38.       fError is generated as SYM files are optional. */
  39.  
  40.     ~FW_CPrivWinSymFile(void);
  41.     /* Frees fMemory allocated for the symbol data storage. */
  42.  
  43.     FW_Boolean FindSymbol(unsigned short wSeg,
  44.                           unsigned short fOffset,
  45.                           unsigned short cbMaxLen,
  46.                           char* pzName);
  47.     /* Attempts to locate a symbol in the file.  wSeg is the ordinal segment
  48.       number in a Windows executable file and wOfs is the Offset within that
  49.       segment.  If succesfull, copies the name to pzName, cbMaxLen is the buffer
  50.       size. */
  51.  
  52. private:
  53.     void* fSymData;
  54.     
  55.     FW_CPrivWinSymFile(const FW_CPrivWinSymFile& symFile);
  56.     FW_CPrivWinSymFile& operator=(const FW_CPrivWinSymFile& symFile);
  57.         // Don't copy instances of this class.
  58. };
  59.  
  60.  
  61. //========================================================================================
  62. // FW_CPrivWinDebugModuleList:
  63. //
  64. // A class for obtaining symbolic info on Windows modules.  Useful for stack
  65. // walk and FW_DEBUG messages.
  66. //========================================================================================
  67.  
  68. class FW_CPrivWinDebugModuleList
  69. {
  70. public:
  71.     static void Initialize(void);
  72.     static void Terminate(void);
  73.  
  74.     static FW_Boolean FindSymbol(HANDLE fModule,
  75.                                  unsigned short wSeg,
  76.                                  unsigned short fOffset,
  77.                                     unsigned short cbMaxLen,
  78.                                     char* pzName);
  79.     /* Attempts to locate a symbol in a Windows module.  See comment for
  80.       FW_FW_CSymFile::FindSymbol above.  fModule is the module handle as returned
  81.       by TOOLHELP.DLL: do not pass instance handles! */
  82.       
  83.     static FW_Boolean GetModuleName(HANDLE fModule,
  84.                                     char* pzName);
  85.     /* Returns a short 8-char name of module identified by handle fModule. */
  86.  
  87.     enum
  88.     {
  89.         kMaxModules = 64,
  90.         kModuleNotFound = 128
  91.     };
  92.  
  93. private:
  94.     struct sOneModule
  95.     {
  96.         HANDLE fModule;
  97.         FW_CPrivWinSymFile* fSymFile;
  98.         char fModuleName[10];
  99.     };
  100.     
  101.     static sOneModule fModules[];
  102.     static unsigned short fNumberOfModules;
  103.     
  104.     static unsigned short FindModule(HANDLE fModule);
  105.     /* Searches the list for the module identified by fModule.  If the module is not
  106.       present yet, creates a new fEntryArray creates a FW_CPrivWinSymFile for it. Returns module index
  107.       on success, kModuleNotFound on failure */
  108.     
  109.     static unsigned short AddModule(HANDLE fModule);
  110.     /* Called by FindModule When the module fModule is not present in the list. */
  111.  
  112.     FW_CPrivWinDebugModuleList();
  113.         // Don't construct this object.
  114. };
  115.  
  116.  
  117. #endif // FW_DEBUG
  118.  
  119. #endif // FWSYMFIL_H
  120.  
  121.